[XEN] Only parse the crashkernel command line parameter once on boot
authorIan Campbell <ian.campbell@xensource.com>
Thu, 30 Nov 2006 18:44:55 +0000 (18:44 +0000)
committerIan Campbell <ian.campbell@xensource.com>
Thu, 30 Nov 2006 18:44:55 +0000 (18:44 +0000)
not each time it is requested.

Signed-off-by: Ian Campbell <ian.campbell@xensource.com>
xen/arch/x86/setup.c
xen/common/kexec.c

index 43d1f63b7136a542e749ea2c3cf7226dea056e43..391a50eb05c7196b4997ec213b7cf73fc31ce636 100644 (file)
@@ -299,7 +299,6 @@ void __init __start_xen(multiboot_info_t *mbi)
     unsigned long nr_pages, modules_length;
     paddr_t s, e;
     int i, e820_warn = 0, e820_raw_nr = 0, bytes = 0;
-    xen_kexec_reserve_t crash_area;
     struct ns16550_defaults ns16550 = {
         .data_bits = 8,
         .parity    = 'n',
@@ -480,8 +479,7 @@ void __init __start_xen(multiboot_info_t *mbi)
 #endif
     }
 
-    machine_kexec_reserved(&crash_area);
-    if ( crash_area.size > 0 )
+    if ( kexec_crash_area.size > 0 )
     {
         unsigned long kdump_start, kdump_size, k;
 
@@ -489,8 +487,8 @@ void __init __start_xen(multiboot_info_t *mbi)
 
         init_boot_pages(initial_images_start, initial_images_end);
 
-        kdump_start = crash_area.start;
-        kdump_size = crash_area.size;
+        kdump_start = kexec_crash_area.start;
+        kdump_size = kexec_crash_area.size;
 
         printk("Kdump: %luMB (%lukB) at 0x%lx\n",
                kdump_size >> 20,
index 31e581a07f96acffbdf2c7adfb2bd58252e6783e..f3f5f017316782a073293a56f7c66137464e70e7 100644 (file)
@@ -22,9 +22,6 @@
 #include <xen/version.h>
 #include <public/elfnote.h>
 
-static char opt_crashkernel[32] = "";
-string_param("crashkernel", opt_crashkernel);
-
 DEFINE_PER_CPU (crash_note_t, crash_notes);
 cpumask_t crash_saved_cpus;
 int crashing_cpu;
@@ -39,6 +36,26 @@ unsigned long kexec_flags = 0; /* the lowest bits are for KEXEC_IMAGE... */
 
 spinlock_t kexec_lock = SPIN_LOCK_UNLOCKED;
 
+xen_kexec_reserve_t kexec_crash_area;
+
+static void __init parse_crashkernel(char *str)
+{
+    unsigned long start, size;
+
+    size = parse_size_and_unit(str, &str);
+    if ( *str == '@' )
+        start = parse_size_and_unit(str+1, NULL);
+    else
+        start = 0;
+
+    if ( start && size )
+    {
+        kexec_crash_area.start = start;
+        kexec_crash_area.size = size;
+    }
+}
+custom_param("crashkernel", parse_crashkernel);
+
 static void one_cpu_only(void)
 {
    /* Only allow the first cpu to continue - force other cpus to spin */
@@ -134,34 +151,10 @@ static __init int register_crashdump_trigger(void)
 }
 __initcall(register_crashdump_trigger);
 
-void machine_kexec_reserved(xen_kexec_reserve_t *reservation)
-{
-    unsigned long start, size;
-    char *str = opt_crashkernel;
-
-    memset(reservation, 0, sizeof(*reservation));
-
-    size = parse_size_and_unit(str, &str);
-    if ( *str == '@' )
-        start = parse_size_and_unit(str+1, NULL);
-    else
-        start = 0;
-
-    if ( start && size )
-    {
-        reservation->start = start;
-        reservation->size = size;
-    }
-}
-
 static int kexec_get_reserve(xen_kexec_range_t *range)
 {
-    xen_kexec_reserve_t reservation;
-
-    machine_kexec_reserved(&reservation);
-
-    range->start = reservation.start;
-    range->size = reservation.size;
+    range->start = kexec_crash_area.start;
+    range->size = kexec_crash_area.size;
     return 0;
 }